<template>
  <a-card :bordered='false'>
    <div class='table-page-search-wrapper'>
      <a-form layout='inline' :form='searchForm'>
        <a-row :gutter="48">
          <a-col :md="8" :sm="24">
            <a-form-item label="姓名">
              <a-input placeholder="请输入姓名" v-model="queryParam.userName"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-form-item label="联系方式">
              <a-input placeholder="请输入联系方式" v-model="queryParam.mobile"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="24">
            <a-button @click="() => {this.queryPage()}" type="primary">查询</a-button>
            <a-button @click="() =>{ queryParam = {}}" style="margin-left: 8px">重置</a-button>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <div class='table-operator'>
      <a-button @click="(e) =>{ this.goToUpdate()}" style="margin-bottom: 8px" type="primary">
        同步钉钉数据
      </a-button>
    </div>
    <v-table
      :table-column="columns"
      :data="loadData"
      :rowKey="records => records.id"
      bordered
      ref="table"
    >
      <template v-slot:action='{text,row}'>
        <div class='actionColumn'>
          <span>
            <a-divider type='vertical'/>
            <a href='javascript:' @click='show(row)'>查看</a>
          </span>
          <span>
            <a-divider type='vertical'/>
            <a href='javascript:' @click='update(row)'>编辑</a>
          </span>
        </div>
      </template>
    </v-table>
    <wfu-tentment-add-or-update
      @ok='queryPage'
      ref='editor'>
    </wfu-tentment-add-or-update>
  </a-card>
</template>

<script>
import { queryParam,columns } from '@views/modules/wfucheck/wfuTenement/template'
import WfuTentmentAddOrUpdate from '@views/modules/wfucheck/wfuTenement/wfu-tentment-add-or-update'
import { fetchList } from '@api/wfuTenement/tenement'
import { syncByDingUser } from '@api/HongtaiClockIn/SyncDingTalk'
export default {
  name: 'wfu-tenement',
  components: { WfuTentmentAddOrUpdate },
  data(){
    return{
      searchForm:this.$form.createForm(this),
      queryParam,
      columns,
      loadData:parameter =>{
        return fetchList(
          Object.assign(parameter,this.queryParam)
        ).then(res =>{
          return res.data
        })
      },
    }
  },
  methods:{
    goToUpdate() {
      //同步数据
      syncByDingUser()
      //刷新
      this.$refs.table.refresh()
    },
    show(record) {

    },
    update(record) {

    },
  }
}
</script>

<style scoped>

</style>